<!-- /** * 注销审核流程v2 */ -->
<template>
  <div class="writeOff">
    <inputSelect :isShowCity="false" :contentData.sync="contentData" :JFData.sync="JFData" :title="'申请理由'" @getValues="getValues" />
    <inputSelect :isShowCity="false" :contentData.sync="contentData1" :JFData.sync="JFData" :title="'审核意见'" @getValues="getValues" />
    <upLoad :rowData="rowData" :FJData="FJData1" :isReadOnly="true" :SHITUID="'98bcf528966e48ce896a8b3fd02d45d5'" :UpLoadID="'7a3fc061c866434b8475d3775c9ddcea'" />
    <div class="footer">
      <van-button style="width: 80vw" size="big" type="info" @click="saveData">提交</van-button>
    </div>
  </div>
</template>

<script>
import inputSelect from '../public/inputSelect'
import upLoad from '@/utils/upLoad'
import { GSA_Add, GSA_Search } from '@/common/commonApi'
import timeFormat from '@/utils/timeFormat.js'
export default {
  data() {
    return {
      rowData: {},
      JFData: [
        {
          SQLY: '',
          SQR: '',
          SQSJ: '',
          SHJL: '',
          SHYJ: '',
          SHR: '',
          SHSJ: ''
        }
      ],
      contentData: [
        {
          label: '申请理由',
          key: 'SQLY',
          ISinput: true,
          required: true,
          readonly: false,
          isTime: false
        },
        {
          label: '申请人',
          key: 'SQR',
          ISinput: true,
          required: true,
          readonly: false,
          isTime: false
        },
        {
          label: '申请时间',
          key: 'SQSJ',
          ISinput: true,
          required: true,
          readonly: false,
          isTime: false
        }
      ],
      contentData1: [
        {
          label: '审核结论',
          key: 'SHJL', //绑定的字段
          ISinput: false, //true:输入框
          required: true, //true: 必填项
          readonly: true, //true:可以填写 false：不可以填写
          isTime: false, //true:可以时间选择器 false：下拉框
          emitData: '',
          NYDARR: [
            {
                DICNAME: '拟同意',
                DICKID: '9'
            },
            {
                DICNAME: '不同意',
                DICKID: '10'
            }
          ]
        },
        {
          label: '审核意见',
          key: 'SHYJ',
          ISinput: true,
          required: true,
          readonly: true,
          isTime: false
        },
        {
          label: '审核人',
          key: 'SHR',
          ISinput: true,
          required: true,
          readonly: false,
          isTime: false
        },
        {
          label: '审核时间',
          key: 'SHSJ',
          ISinput: true,
          required: true,
          readonly: false,
          isTime: false
        }
      ],
      FJData1: [
        {
          title: '盖章扫描件',
          FileName: [],
          groupGuid: '7c1eb8db-1843-4bdd-bd56-22f80828eb2f',
          fileList: []
        }
      ]
    }
  },
  created() {
    this.rowData = JSON.parse(this.$route.query.data)
    this.getSQYJ()
  },
  methods: {
    /**
     * 申请意见
     */
    async getSQYJ() {
      let data = [{ field: 'TO_ROW_GUID', value: this.rowData.ROW_GUID }]
      const res = await GSA_Search('80a12eb5-d632-4422-a523-aed6d1ba5d94', data)
      res.Data.forEach((item) => {
        for (let i in item) {
          for (let j in this.JFData[0]) {
            if (i == j) {
              this.JFData[0][i] = item[i]
            }
          }
        }
      })
      //赋值
      console.log(JSON.parse(window.localStorage.getItem('userName')))
      this.JFData[0].SHR = JSON.parse(window.localStorage.getItem('userName')).userName
      let timeFormat1 = timeFormat(null, 'yyyy-mm-dd hh:MM:ss')
      this.JFData[0].SHSJ = timeFormat1
    },
    async saveData() {
      let data = [{"TO_ROW_GUID":this.rowData.ROW_GUID,"SHJL":this.JFData[0].SHJL,"SHYJ":this.JFData[0].SHYJ,"SHR":this.JFData[0].SHR,"SHSJ":this.JFData[0].SHSJ}]
      const res = await GSA_Add('80a12eb5-d632-4422-a523-aed6d1ba5d94',false, ...data)
      if(res){
        let parmes1 = [{ PKID: this.rowData.PKID, ISDELETE: 13 }]
        const upres = await GSA_Add('06424a16-746c-4650-ae97-a774402de7cd', false, ...parmes1)
      }
    },
    getValues() {}
  },
  components: {
    inputSelect,
    upLoad
  }
}
</script>

<style lang="scss" scoped>
.writeOff {
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  padding: 10px 6px;
  .footer {
    height: 6vh;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}
</style>
